<template>
  <!-- 雷达图  图表必须给高和宽度-->
  <div ref="myDiv" class="radar-echart" />
</template>

<script>
import * as echarts from 'echarts/core'
import { TooltipComponent, LegendComponent } from 'echarts/components'
import { RadarChart } from 'echarts/charts'
import { CanvasRenderer } from 'echarts/renderers'

echarts.use([TooltipComponent, LegendComponent, RadarChart, CanvasRenderer])

export default {
  data() {
    return {

    }
  },
  mounted() {
    const myChart = echarts.init(this.$refs.myDiv)
    myChart.setOption({
      legend: {
        data: ['个人成绩', '平均成绩']
      },
      radar: {
        // shape: 'circle',
        indicator: [
          { name: '1', max: 6500 },
          { name: '2', max: 16000 },
          { name: '3', max: 30000 },
          { name: '4', max: 38000 },
          { name: '5', max: 52000 },
          { name: '6', max: 25000 }
        ]
      },
      series: [
        {
          name: 'Budget vs spending',
          type: 'radar',
          data: [
            {
              value: [4200, 3000, 20000, 35000, 50000, 18000],
              name: '个人成绩'
            },
            {
              value: [5000, 14000, 28000, 26000, 42000, 21000],
              name: '平均成绩'
            }
          ]
        }
      ]

    })
  }
}
</script>

<style>
.radar-echart {
    width: 600px;
    height: 400px;
}
</style>
